<template>
	<view class="coupon-item">
		<view class="coupon-money">
			<u--text :text="item.name" type="info" ></u--text>
			<block v-if="item.is_free == 1">
				<view class="layof">免单</view>
			</block>
			<block v-else>
				<view class="layof" v-if="item.coupon_type == 10">￥{{item.reduce_price}}</view>
				<view class="layof" v-if="item.coupon_type == 20">{{item.discount}}折</view>
				<view class="layof" v-if="item.coupon_type == 30">{{item.discount}}折</view>
				<view class="layof" v-if="item.coupon_type == 40">{{item.reduce_price}}元</view>
			</block>
			<view class="end_time" v-if="item.is_work != 0">使用期限：{{item.end_time}}前</view>
			
			<view class="end_time">使用范围：{{item.pinlei}}</view>

			<view class="end_time">使用说明：{{item.remark}}</view>
		</view>

		<view class="get-btn" style="background-color: #ececec;border: 1px solid #ececec;color: #ccc;"
			v-if="item.is_work == 0">待激活</view>
		<view class="get-btn" v-if="types == 'select' && item.is_work == '1'" @click="onTap(item)">选择使用</view>
		<navigator class="get-btn" v-if="types == '' && item.is_work == '1'"
			:url="'/pages/activity/activity?coupon_id=' + e.coupon_id" open-type="switchTab">立即使用</navigator>
	</view>
</template>

<script>
	export default {
		components: {

		},
		data() {
			return {
				show: false,
			}
		},
		props: {
			item: {
				type: Object
			},
			types: {
				type: String,
				default: ''
			},
			theme: {
				type: String,
				default: '#ffd91d'
			},
			solid: {
				type: String,
				default: '#ffffff'
			},
			color: {
				type: String,
				default: '#ffd91d'
			},
		},

		methods: {
			onTap(item) {
				this.$emit('use', item)
			},

		}
	}
</script>

<style lang='scss'>
	.coupon-item {
		width: 660rpx;
		display: table;
		border-radius: 10upx;
		padding: 0 20upx;
		margin-top: 22upx;
		border: 1px solid #eeeeee;
		position: relative;


		.coupon-money {
			width: 465upx;
			height: auto;
			display: table;
			float: left;
			padding: 26upx 0;
			padding-right: 10upx;
			border-style: none dotted none none;
			border-color: #eeeeee;

			.nick {
				width: 100%;
				height: 50upx;
				line-height: 30upx;
				font-size: 24upx;
				color: #999999;
			}

			.tit {
				width: 100%;
				height: 50upx;
				line-height: 50upx;
				font-size: 24upx;
				color: #999999;
			}

			.demand {
				width: 100%;
				height: 30upx;
				line-height: 30upx;
				font-size: 24upx;
				color: #999999;
			}

			.layof {
				width: 100%;
				line-height: 58upx;
				font-size: 40upx;
				color: #FE552D;
				font-weight: bold;
			}

			.layof-name {
				width: 100%;
				height: 42upx;
				line-height: 30upx;
				font-size: 44upx;
				color: #ffd91d;
				font-weight: bold;
			}

			.end_time {
				width: 100%;
				line-height: 36upx;
				font-size: 22upx;
				color: #909399;
			}
		}

		.get-btn {
			width: 130upx;
			height: 52upx;
			line-height: 50upx;
			position: absolute;
			top: 50%;
			right: 26upx;
			margin-top: -26upx;
			text-align: center;
			border-radius: 60upx;
			color: #fff;
			background-color: #ffd91d;
			border: 1px solid #ffd91d;
			font-size: 24upx;
			float: right;
		}
	}

	.coupon-item:after {
		width: 40upx;
		height: 20upx;
		position: absolute;
		left: 460upx;
		top: -1px;
		border-radius: 0 0 40upx 40upx;
		content: "";
		display: block;
		background: #fff;
		border: 1px solid #eeeeee;
		border-top: 0px;
	}

	.coupon-item:before {
		width: 40upx;
		height: 20upx;
		position: absolute;
		left: 460upx;
		bottom: -1px;
		border-radius: 40upx 40upx 0 0;
		content: "";
		display: block;
		background: #fff;
		border: 1px solid #eeeeee;
		border-bottom: 0px;
	}
</style>